package z.explorer.ui.component.navigator;

import javax.swing.tree.DefaultMutableTreeNode;

import z.explorer.ui.common.Handler;

public class ZTreeNode extends DefaultMutableTreeNode {
	
	private static final long serialVersionUID = 5093300713433009736L;
	
	private String name="";
	
	private Handler handler = null;
	
	/*Constructor*/
	public ZTreeNode(){
		name="";
	}
	
	public ZTreeNode(String name){
		this.name=name;
	}
	
	public ZTreeNode(String n,Handler h){
		name=n;
		handler=h;
	}
	
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

		
	public Handler getHandler() {
		return handler;
	}

	public void setHandler(Handler handler) {
		this.handler = handler;
	}

	
	
	@Override
	public boolean isLeaf() {
		// TODO Auto-generated method stub
		return handler==null?false:true;
	}
	
	

	@Override
	public boolean getAllowsChildren() {
		// TODO Auto-generated method stub
		return !isLeaf();
	}

	@Override
	public String toString() {
		return name;
	}
	
	
}
